import boxen from 'boxen'
import { type } from 'os'
process.env.FORCE_COLOR = type() === 'Darwin' ? 3 : 2

export const successBoxen = (text) => console.log(
  `\n${boxen(text, {
    title: `文西小助手 - 成功`,
    margin: { top: 1, bottom: 1 },
    padding: { left: 1, right: 1 },
    borderStyle: 'double',
    borderColor: 'green',
  })}`
)

export const infoBoxen = (text) => console.log(
  `\n${boxen(text, {
    title: `文西小助手 - 信息`,
    margin: { top: 1, bottom: 1 },
    padding: { left: 1, right: 1 },
    borderStyle: 'double',
    borderColor: 'blue',
  })}`
)

export const warnBoxen = (text) => console.log(
  `\n${boxen(text, {
    title: `文西小助手 - 警告`,
    margin: { top: 1, bottom: 1 },
    padding: { left: 1, right: 1 },
    borderStyle: 'double',
    borderColor: 'yellow',
  })}`
)

export const errorBoxen = (text) => console.log(
  `\n${boxen(text, {
    title: `文西小助手 - 异常`,
    margin: { top: 1, bottom: 1 },
    padding: { left: 1, right: 1 },
    borderStyle: 'double',
    borderColor: 'red',
  })}`
)
